import { reactive,onMounted,onBeforeUnmount} from "vue";
export default function () {
  // 数据
  let point = reactive({
    x: 0,
    y: 0
  })

  // 方法
  function savePoint(event) {
    console.log(event);
    point.x = event.pageX
    point.y = event.pageY
  }

  // 生命周期钩子
  onMounted(()=>{
    window.addEventListener('mousemove',savePoint)
  })
  onBeforeUnmount(()=>{
    window.removeEventListener('mousemove',debounce)
  })
  return point 
}